<?php

class Zend_View_Helper_Menu extends Zend_View_Helper_Abstract {

    protected $_menuType;
    protected $_country;
    protected $_language;
    protected $_shMenu = array( 'FR' => array(  'takerapp'      => 'SH_SUNSET_APP',
                                              ),
                                'GB' => array(  'wall'          => 'SH_SUNSET_WALL',
                                                'takerapp'      => 'SH_SUNSET_APP',
                                                'uploadimage'   => 'SH_SUNSET_UPLOAD_IMAGE'
                                              ),
                                'ES' => array(  'wall'          => 'SH_SUNSET_WALL',
                                                'takerapp'      => 'SH_SUNSET_APP',
                                                'uploadimage'   => 'SH_SUNSET_UPLOAD_IMAGE'
                                              ));

    protected $_cooktailsDomain =  array(  'en' => 'http://www.cooktails.com',
                                           'fr' => 'http://fr.cooktails.com',
                                           'sp' => 'http://es.cooktails.com'
                                        );

    public function menu($name) {
        $session = new Zend_Session_Namespace('GrandMarnier');
        $this->_language = $session->userLanguage;
        $this->_country = $session->country;
        $this->_menuType = $name;
        return $this->getSubMenuItems();
    }

    public function getSubMenuItems() {
        $logger = Zend_Registry::get('log');
        if ($this->_menuType == 'drinks') {
            $selection = new Application_Model_DbTable_CocktailSelection();
            $selection->setLanguage($this->_language);
            return $selection->getAllSelectionsForSEO();
        } elseif ($this->_menuType == 'collection') {
            $selection = new Application_Model_DbTable_ProductGroup();
	    $selection->setLanguage($this->_language);
            return $selection->getAllProductGroupsForSEO();
        } elseif ($this->_menuType == 'sunsethours') {
            if (array_key_exists($this->_country, $this->_shMenu)) {
                return $this->_shMenu[$this->_country];
            } else {
                return $this->_shMenu['GB'];
            }
        } elseif ($this->_menuType == 'cooktails') {
            return $this->_cooktailsDomain[$this->_language];
        } elseif ($this->_menuType == 'desserts') {
            $selection = new Application_Model_DbTable_DesertSelection();
            $selection->setLanguage($this->_language);
            return $selection->getAllSelectionsForSEO();
        }

/*
        $translation = new Application_Model_DbTable_Translation();
        $translation->setLanguage($this->_language);
        $transl = $translation->getAllTranslations();
#        Zend_Debug::dump($transl, '$transl', true);
        if (array_key_exists($this->_keyword, $transl)) {
            if ($transl[$this->_keyword] != "") {
                $logger->info($this->_keyword . ' : ' . $transl[$this->_keyword]);
                return $transl[$this->_keyword];
            } else {
                $logger->err($this->_keyword . ' :  --no translation--');
                return $this->_keyword;
            }
        } else {
            $logger->err($this->_keyword . ' :  --no translation--');
            return $this->_keyword;
        }
*/
     }


    // The default representation of the greeting. Let's be nice, by default.
    public function __toString() {
        return "";
    }

}

#echo  $this->translatex('PRODUCT_HISTORY_WQ');
?>